import axiosReq from '@/utils/axios-req'
const BASE_URL = import.meta.env.VITE_APP_BASE_URL_SYH
// scoring-details-summary
/**
 * 获取汇总表信息
 * @param data
 * @returns
 */
export const getScoringDetailsSummary = () => {
  const projectId = useProjectInfoStore().projectInfo.id
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/getCompletedItemsByProjectId`,
    method: 'POST',
    data: {
      projectId
    }
  })
}

/**
 * 批量导出
 * @param data
{
  "templateList": [
    "评标报告",    
    "开标记录表",
    "招标评标委员会签到单",
    "招标工作人员签到单",
    "招标开标会供应商签到单",
    "评委承诺书",
    "评标汇总"
  ],
  "itemIdList": [
    1,2
  ],
  "projectId": 1
}
 * @returns
 */
export const exportScoringDetailsSummary = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/batchExport`,
    method: 'POST',
    data
  })
}
/**
 * 批量导出 - 模板
 * @param data
 * @returns
 */
export const exportScoringDetailsSummaryTemplate = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/batchExportTemplate`,
    method: 'POST',
    data
  })
}
/**
 * 导出评审项汇总
 * @param data
 * {
  "projectId": 1,
  "itemId": 3
}
 * @returns
 */
export const exportItemSummary = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/exportItemSummary`,
    method: 'POST',
    data
  })
}

/**
 * 导出评委评分汇总
 * @param data
{
  "projectId": 1,
  "judgeId": 1,
  "itemId": 3
}
 * @returns 
 */
export const exportJudgePointScore = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/exportJudgePointScore`,
    method: 'POST',
    data
  })
}

/**
 * 通用导出
 * @param data
 * 需要导出的文件名
 * @returns
 */
export const commonExport = (urlName: string) => {
  const projectId = useProjectInfoStore().projectInfo.id
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/${urlName}`,
    method: 'POST',
    data: { projectId }
  })
}
/**
 * 评委个人报告表单
 * @param data 
 * {
  "projectId": 1
}
 * @returns 
 */
export const getJudgeReportForm = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/judgeReportForm`,
    method: 'POST',
    data
  })
}

/**
 * 批量导出 - 评委个人打分表
 * @param data
 * [
  {
    "projectId": 1,
    "itemId": 1,
    "judgeId": 1
  }
]
 * @returns
 */
export const exportJudgePointScoreBatch = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/batchExportJudgeReportForm`,
    method: 'POST',
    data
  })
}
/**
 * 单个评审项 - 查看评审项汇总信息
 * @param data 
 * {
  "projectId": 1,
  "itemId": 10
}
 * @returns 
 */
export const getItemSummary = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/viewItemSummary`,
    method: 'POST',
    data
  })
}
// 评标汇总
export const getViewSummary = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/viewSummary`,
    method: 'POST',
    data
  })
}
/**
 * 评委评分汇总查看
 * @param data 
 * {
  "projectId": 1,
  "judgeId": 1,
  "itemIds": [
    1,2,3,4
  ]
}
 * @returns 
 */
export const getJudgePointScore = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/summary/viewJudgePointScore`,
    method: 'POST',
    data
  })
}

//
/**
 * 展示开标记录显示字段
 * @param params id=1
 * @returns
 */
export const getOpenBidRecordDisplayFields = (params: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/projectInfo/getBidRecordShowField`,
    method: 'GET',
    params
  })
}

// 更新开标记录显示字段
export const updateBidRecordShowField = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: '/cloud/pbgl/projectInfo/updateBidRecordShowField',
    method: 'POST',
    data,
    showMsg: true
  })
}
